using UnityEngine;
using System.Collections;

public class Jogar : MonoBehaviour 
{
	void Start () 
    {
        this.gameObject.AddComponent("MeshRenderer");
        this.gameObject.AddComponent("MeshFilter");
		this.gameObject.AddComponent("BoxCollider");
		this.gameObject.GetComponent<BoxCollider>().size = new Vector3(3, 2, 0);
		this.gameObject.tag = "Jogar";
		
        Mesh mesh = Quad.Create(2, 1);
		
        this.gameObject.GetComponent<MeshFilter>().mesh = mesh;
        this.gameObject.GetComponent<MeshRenderer>().material = AtlasManager.globalMaterial;

        this.gameObject.GetComponent<MeshFilter>().mesh.uv = new Vector2[]
        {
           new Vector2(AtlasManager.rects[1].xMin, AtlasManager.rects[1].yMax),
           new Vector2(AtlasManager.rects[1].xMax, AtlasManager.rects[1].yMax),
           new Vector2(AtlasManager.rects[1].xMax, AtlasManager.rects[1].yMin),
           new Vector2(AtlasManager.rects[1].xMin, AtlasManager.rects[1].yMin)
        };

        this.transform.position = new Vector3(5, 2, -1);      
	}
	
	void Update () 
    {

	}
	
	void OnMouseDown() 
	{
    	Application.LoadLevel(1);
	}	
}
